import request from "@/utils/request";

/**
 * 查询工作区列表
 * @param query
 * @returns {*}
 */
export function listSiteGroup(query) {
  return request({
    url: "/workSpace/page",
    method: "get",
    params: query,
  });
}

/**
 * 查询工作区详情
 * @param siteGroupId
 * @returns {*}
 */
export function getSiteGroup(siteGroupId) {
  return request({
    url: "/workSpace/selectById",
    method: "get",
    params: {
      siteGroupId,
    },
  });
}

/**
 * 创建工作区
 * @param data
 * @returns {*}
 */
export function addSiteGroup(data) {
  return request({
    url: "/workSpace/add",
    method: "post",
    data: data,
  });
}

/**
 * 修改工作区
 * @param data
 * @returns {*}
 */
export function updateSiteGroup(data) {
  return request({
    url: "/workSpace/update",
    method: "put",
    data: data,
  });
}

/**
 * 删除工作区
 * @param siteGroupId
 * @returns {*}
 */
export function delSiteGroup(siteGroupId) {
  return request({
    url: "/workSpace/delete/" + siteGroupId,
    method: "delete",
  });
}

/**
 * 根据项目id获取对应楼栋信息
 * @param projectId
 * @returns {*}
 */
export function getBanByProjectId(projectId) {
  return request({
    url: "/workSpace/selectByProjectId",
    method: "get",
    params: {
      projectId,
    },
  });
}

/**
 * 获取楼层
 * @param projectId
 * @param banId
 * @returns {*}
 */
export function getFloorsByProjectIdAndSiteGroupId(projectId, banId) {
  return request({
    url: "/workSpace/selectByProjectAndBanId",
    method: "get",
    params: {
      projectId,
      banId,
    },
  });
}

/**
 *查询所有项目
 */
export function getAllProjectsApi() {
  return request({
    url: "/workSpace/selectAllProject",
    method: "get",
  });
}
/**
 *查询所有项目
 */
export function getAllBansApi() {
  return request({
    url: "/workSpace/selectAllBan",
    method: "get",
  });
}
